package com.softeem.controller;

import com.softeem.entity.Type;
import com.softeem.model.UserModel;
import com.softeem.service.BlogService;
import com.softeem.service.TypeService;
import com.softeem.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;
import java.util.Map;

/**
 * @author cj
 * @create 2021-04-2021/4/29 0029 15:28
 */
@Controller
public class PageController {
    @Autowired
    private BlogService blogService;
    @Autowired
    private TypeService typeService;
    @Autowired
    private UserService userService;

    @RequestMapping("/index")
    public String pageToIndex(Map<String,Object> map){
        List<Type> types = typeService.getTypes();
//        System.out.println(types);
        map.put("type",types);

        List<UserModel> userfs = userService.getUsers();
        map.put("Userfs",userfs);
        System.out.println(userfs);

        return "index";
    }

    @RequestMapping("/iframeType.html")
    public String pageToIframeType(Map<String,Object> map, String tName){
        map.put("blog",blogService.getBlog(tName,0,5));

        return "iframeType";
    }


}